package cn.com.api.mapper.base;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.*;

import cn.com.api.entity.ApiU_advert;

//DAO
public interface U_advertMapperBase {

	// 根据id查看
	@Select("SELECT * FROM U_ADVERT  WHERE ID = #{id}")
	public ApiU_advert findU_advertById(Integer id);

	// 查看数据集
	@Select("SELECT * FROM U_advert")
	public List<ApiU_advert> findU_adverts();

	// 添加
	public int insertU_advert(ApiU_advert u_advert);

	// 修改
	@Update("UPDATE U_ADVERT SET ADV_NAME = #{adv_name,jdbcType=VARCHAR}, ADV_DESC = #{adv_desc,jdbcType=VARCHAR}, "
			+ "ZAN_COUNT = #{zan_count,jdbcType=INTEGER}, POSITION_ID = #{position_id,jdbcType=INTEGER}, "
			+ "ADD_TIME = #{add_time,jdbcType=VARCHAR}, ENT_ID = #{ent_id,jdbcType=VARCHAR},"
			+ " ADD_UID = #{add_uid,jdbcType=VARCHAR}, RESOURCE_TYPE = #{resource_type,jdbcType=INTEGER}, "
			+ "PROVINCE = #{province,jdbcType=VARCHAR}, CITY = #{city,jdbcType=VARCHAR}, "
			+ "TOTAL_AMOUNT = #{total_amount,jdbcType=NUMERIC}, AGE_RANGE = #{age_range,jdbcType=VARCHAR}, "
			+ "JOB_TITLE = #{job_title,jdbcType=VARCHAR}, INTEREST_KEY = #{interest_key,jdbcType=VARCHAR}, "
			+ "LOGO = #{logo,jdbcType=VARCHAR}, LATITUDE = #{latitude,jdbcType=VARCHAR}, "
			+ "LONGITUDE = #{longitude,jdbcType=VARCHAR}, SHOW_TIMES = #{show_times,jdbcType=INTEGER}, "
			+ "BONUS_ID = #{bonus_id,jdbcType=VARCHAR}, EXT1 = #{ext1,jdbcType=VARCHAR}, "
			+ "EXT2 = #{ext2,jdbcType=VARCHAR}, EXT3 = #{ext3,jdbcType=VARCHAR}, "
			+ "EXT4 = #{ext4,jdbcType=VARCHAR}, EXT5 = #{ext5,jdbcType=VARCHAR}, "
			+ "SORT = #{sort,jdbcType=INTEGER}, AREA = #{area,jdbcType=VARCHAR}, "
			+ "DETAIL_URL = #{detail_url,jdbcType=VARCHAR}, DISTANCE_RANGE = #{distance_range,jdbcType=BIGINT}, "
			+ "START_TIME = #{start_time,jdbcType=VARCHAR}, END_TIME = #{end_time,jdbcType=VARCHAR}, "
			+ "STATUS = #{status,jdbcType=INTEGER}, ADDRESS = #{address,jdbcType=VARCHAR}, "
			+ "COVERS = #{covers,jdbcType=VARCHAR}, IS_PAY = #{is_pay,jdbcType=INTEGER}, "
			+ "sign_term = #{sign_term,jdbcType=INTEGER}, platform_charge = #{platform_charge,jdbcType=NUMERIC}, "
			+ "template_id = #{template_id,jdbcType=INTEGER},is_delete = #{is_delete,jdbcType=INTEGER} WHERE ID = #{id}")
	public int updateU_advert(ApiU_advert u_advert);

	// 删除
	@Delete("DELETE FROM U_ADVERT  WHERE ID = #{id}")
	public int deleteU_advert(Integer id);

	// 软删除
	@Delete("update U_ADVERT set is_delete = 1 WHERE ID = #{id}")
	public int deleteAdvert(Integer id);

	// Foreign keys revelant

	// region Indexs revelant

}
